/*
 * Main.fx
 *
 * Created on Oct 30, 2010, 12:16:00 PM
 */

package tvguide;

/**
 * @author Nuno
 */
public class Main {

var drag : Boolean;


    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:main
    public-read def button: javafx.scene.control.Button = javafx.scene.control.Button {
        layoutX: 101.0
        layoutY: 47.0
        onMouseDragged: buttonOnMouseDragged
        onMousePressed: buttonOnMousePressed
        onMouseReleased: buttonOnMouseReleased
        text: "Button"
    }
    
    public-read def scene: javafx.scene.Scene = javafx.scene.Scene {
        width: 480.0
        height: 320.0
        content: getDesignRootNodes ()
    }
    
    public-read def currentState: org.netbeans.javafx.design.DesignState = org.netbeans.javafx.design.DesignState {
    }
    
    public function getDesignRootNodes (): javafx.scene.Node[] {
        [ button, ]
    }
    
    public function getDesignScene (): javafx.scene.Scene {
        scene
    }
    // </editor-fold>//GEN-END:main

    function buttonOnMouseDragged (event: javafx.scene.input.MouseEvent): Void {
        if(drag){
            button.translateX = event.dragX;
            button.translateY = event.dragY;

            

        }

    }

    function buttonOnMouseReleased (event: javafx.scene.input.MouseEvent): Void {
        drag=false;

    }

    function buttonOnMousePressed (event: javafx.scene.input.MouseEvent): Void {
        drag = true;

    }

}

function run (): Void {
    var design = Main {};

    javafx.stage.Stage {
        title: "Main"
        scene: design.getDesignScene ()
    }
}
